using System.Security.Claims;
using System.Threading.Tasks;
using CRM.Models;
using HotChocolate;
using HotChocolate.Authorization;
using Microsoft.AspNetCore.Identity;

namespace CRM.Graphql;

[Authorize]
public partial class Query
{
    public async Task<User> Me(ClaimsPrincipal user,
        [Service] UserManager<User> userManager)
    {
        return await userManager.GetUserAsync(user);
    }
}